


/**
 *  1.泛型函数指定  <T> 函数名(T t):T
 *  2.接口泛型指定  interface 接口类型<T>{ data:T}
 */

//啥是泛型??? 
//不确定类型,但是一旦使用还需要确定! 
//变得灵活 -><T> {code: , msg: ,  T data: [] {} null}
//public T <T,BK> 方法(T 参数,BK 参数2)

//1.泛型参数
function fn1 <T> (account:string, data:T):[string,T]{
    return [account,data];
}

//2.泛型接口
interface Person<T>{
    name:string,
    age:number,
    data: T
}
//ts - 前端
//前端 -> 接收 -> 后台返回的json -> {code:200,message:"xxx",data:{}}
interface baseProperty{
    id:number,
    createTime:string
}

interface room extends baseProperty {
   roomName:string
}

interface apartment extends baseProperty {
    apartmentName:string
 }

interface Response1<T>{
    code:number,
    message:string,
    data: T
} 


//接收房间业务
let roomResponse:Response1<room> = {
    code:200,
    message:"xx",
    data:{
        id:1,
        createTime:"",
        roomName:"xx" 
   }
}